<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/global.jsp" %>
<style>
</style>
<script type="text/javascript">
    $(function() {
    	   $('#processTypeAddPid').combotree({
               url : '${path }/processType/tree',
               parentField : 'pid',
               lines : true,
               panelHeight : 'auto'
           });
        $('#processTypeAddForm').form({
            url : '${path}/processType/add',
            onSubmit : function() {
                progressLoad();
                var isValid = $(this).form('validate');
                if (!isValid) {
                    progressClose();
                }
                return isValid;
            },
            success : function(result) {
                progressClose();
                result = $.parseJSON(result);
                if (result.success) {
                    showMsg(result.msg);
                    parent.$.modalDialog.openner_treegrid.treegrid('reload');//之所以能在这里调用到parent.$.modalDialog.openner_dataGrid这个对象，是因为user.jsp页面预定义好了
                    parent.$.modalDialog.handler.dialog('close');
                } else {
                    var form = $('#processTypeAddForm');
                    parent.$.messager.alert('错误', result.msg, 'error');
                }
            }
        });
        
        $('#processTypeAdd_type').change(function(){
        	var val=$(this).val();
        	if(val==0){
        		$('#processTypeAdd_procdefid').attr("disabled",true)
        		$('#processTypeAdd_key').attr("disabled",true)
        		$('#processTypeAdd_version').attr("disabled",true)
        	}else{
        		$('#processTypeAdd_procdefid').attr("disabled",false)
        		$('#processTypeAdd_key').attr("disabled",false)
        		$('#processTypeAdd_version').attr("disabled",false)
        	}
        })
    });
</script>
<div class="easyui-layout" data-options="fit:true,border:false" >
    <div data-options="region:'center',border:false" style="overflow-x:hidden;overflow-y: auto;padding: 3px;" >
        <form id="processTypeAddForm" method="post">
            <table class="grid">
 				<tr>
                      <td>名称</td>
                      <td>
                        <input name='name'   type='text' placeholder='请输入名称' class='easyui-text-2  span2' >
                     </td>
                     <td>类型</td>
                     <td>
                     	<select id="processTypeAdd_type" class="easyui-text-2 easyui-validatebox" data-options="required:true" name="type">
                     		<option value="">请选择</option>
                     		<option value="0">分类</option>
                     		<option value="1">流程</option>
                     	</select>
                     </td>
                  </tr> <tr>
                     <td>排序</td>
                      <td>
                        <input name='seq' id='seq'  type='number' placeholder='请输入排序' class='easyui-text-2  span2' >
                     </td>
                     <td>流程定义ID</td>
				 	<td>
				 		<input type="text" name="procdefid" id="processTypeAdd_procdefid" class="easyui-text-2 "/>
				 	</td>
                  </tr>
                  <tr>
					<td>图标</td>
	                <td>
	                <input type="text" class="easyui-text-2" name="iconCLs" value="fi-folder"/>
	                </td>
	                <td>版本</td>
	                <td>
	                	<input type="text" class="easyui-text-2" name="version" placeholder="请输入版本号" id="processTypeAdd_version"/>
	                </td>
					</tr>
					<tr>
					 <td>key值</td>
                      <td>
                        <input name='key'   type='text' placeholder='请输入key值' class='easyui-text-2  span2' id="processTypeAdd_key">
                     </td>
                        <td>部署ID</td>
                        <td><input type="text" name="deploymentId" class="easyui-text-2"></td>
					</tr>
                  <tr>
                  	<td>上级</td>
                  	 <td colspan="3"><select id="processTypeAddPid" name="pid" style="width:200px;height: 29px;"></select>
                <a class="easyui-linkbutton" href="javascript:void(0)" onclick="$('#processTypeAddPid').combotree('clear');" >清空</a></td>
                  </tr>
            </table>
        </form>
    </div>
</div>